<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>聘途</title>
    <link rel="icon" href="/image/favicon.ico" type="image/x-icon"/>
    <script src="/vue.min.js"></script>
    <script src="/axios.min.js"></script>
    <style>
        .home-page {
            border: none;
            height: 1200px;
            background-image: linear-gradient(to bottom, #d1eded, white);
            background-position: to center;

        }

        .menu {
            border: none;
            height: 5%;
            background-color: #202329;
            display: flex;
            align-items: center;
            /*垂直居中*/
        }

        .menu1 {
            list-style-type: none;
            margin-left: 5%;
            overflow: hidden;
        }

        .menu2 {
            text-align: center;
            color: white;
            float: left;
            width: 140px;
            font-size: large;


        }

        .menu2:hover {
            color: #00b4b3;
        }

        .usercenter {
            list-style-type: none;
            overflow: hidden;
            float: left;
            color: rgb(255, 255, 255);
            font-size: large;
            display: flex;
            margin-left: 800px;

        }

        .usercenter:hover {
            color: #00b4b3;
        }


        .image {
            border: none;
            height: 11.5%;
            background-image: url('/image/求职者首页图片1.jpeg');
            background-size: 100% 100%;
        }


        .search1 {
            width: 600px;
            height: 45px;
            background-color: white;
            margin-top: 4%;
            margin-left: 32%;
            border-radius: 15px;

        }

        #searchselect {
            border: none;
            outline: none;
            width: 100px;
            height: 40px;
            border-radius: 15px;


        }

        .search1 input {
            margin-left: 0px;
            border: none;
            outline: none;
            width: 410px;
            height: 40px;
            border-radius: 15px;
            font-size: large;
        }

        #bt {
            background-color: white;
            width: 70px;
            border: none;
            outline: none;
            cursor: pointer;
            /* 将鼠标样式改为指针样式 */
            transition: all 0.3s ease;
            /* 添加过渡效果 */
        }

        .work {

            margin-top: 5%;


        }

        .job {
            display: flex;
            margin-left: 5%;
            margin-top: 50px;
            width: 55%;
            height: 150px;
            background-color: rgb(255, 255, 255);
            color: rgb(0, 0, 0);
            border: 1px;
            cursor: pointer;
            transition: all 0.3s ease;
            border-radius: 15px;

        }

        .job:hover {
            color: rgb(122, 226, 205)
        }

        .p1 {
            position: absolute;
            margin: 0;
        }
    </style>
</head>

<body onload="fun1()">
    <div id="app">
        <div class="home-page">
            <div class="menu">
                  <h2 style="margin-left: 10%;color: #2fdfd1;">聘途</h2>
                <ul class="menu1">
                    <a href="首页.html">
                        <li class="menu2">首页</li>
                    </a>
                    <a href="推荐.html">
                        <li class="menu2">推荐</li>
                    </a>
                    <a href="首页公司.html">
                        <li class="menu2">公司</li>
                    </a>
                    <a href="APP.html">
                        <li class="menu2">APP</li>
                    </a>

                </ul>

                <a href="修改密码.html">
                    <li class="usercenter"> {{ userInfo.sname }}</li>
                </a>

            </div>

            <div class="image"></div>

            <div class="search">
                <form @submit.prevent="submitForm">
                    <div class="search1">
                        <select id="searchselect" v-model="searchselect">
                            <option value="岗位">按岗位搜索</option>

                            <option value="公司">按公司搜索</option>
                        </select>

                        <input type="text" v-model="searchinput" placeholder="请输入搜索内容">
                        <input type="submit" value="搜索" id="bt">
                    </div>
                </form>

            </div>

            <div class="work">

                <div v-for="jobInfo in jobSort.comPositionList">



                    <button class="job" @click="jobdescribe(jobInfo)">
                        <p class="p1" style="margin-left: 5%;margin-top: 20px ;font-family: 宋体;font-size: 20px;">
                            <b>{{jobInfo.pname}}</b> [{{jobInfo.paddress}}]
                        </p>
                        <p class="p1" style="margin-left: 750px;margin-top: 50px ;font-family: 宋体;font-size: 25px;">
                            <b>{{jobInfo.cname}}</b>
                        </p>
                        <p class="p1" style="margin-left: 5%;margin-top: 75px ;font-family: 宋体;font-size: 18px;">
                            <b style="color: rgb(0, 148, 239);">薪资 : {{jobInfo.salary}} </b>
                        </p>
                        <p class="p1" style="margin-left: 15%;margin-top: 75px ;font-family: 宋体;font-size: 18px;">
                            <b style="color: rgb(254, 69, 69);">热度 : {{jobInfo.hot}}</b>
                        </p>
                    </button>

                </div>


            </div>


        </div>
    </div>
    <script>
        var userInfo = JSON.parse(sessionStorage.getItem('userData'));
        var jobSort = JSON.parse(sessionStorage.getItem('jobSort'));


        new Vue({
            el: '#app',
            data: {
                searchselect: '岗位',
                searchinput: '',
             

            },

          

            methods: {

               
                
                jobdescribe(jobInfo) {
                    console.log(jobInfo);
                    // 可以使用 sessionStorage 保存 jobInfo
                    sessionStorage.setItem('jobInfo', JSON.stringify(jobInfo));
                    window.location.href = "首页分类推荐-求职页面.html";

                },


                submitForm() {


                    let data = new FormData();
                    data.append("choice", this.searchselect);
                    data.append("keyword", this.searchinput);


                    axios.post("http://localhost:8080/hqdx/seeker/searchforPosition", data)
                        .then(response => {
                            if (response.data.success == true) {
                                if (response.data.data.choice2 == '岗位') {
                                    console.log(response.data.data.items)

                                    window.location.href = "岗位分类.html";
                                    sessionStorage.setItem('workinfo', JSON.stringify(response.data.data.items));

                                }

                                else {
                                    console.log(response.data.data.items)
                                    window.location.href = "公司.html";
                                    sessionStorage.setItem('companyinfo', JSON.stringify(response.data.data.items));

                                }


                            }
                            else {
                                alert('无法找到搜索内容')
                            }
                        })
                        .catch(error => {
                            console.log(error);
                        });
                },


            }
        })
    </script>
</body>

</html>